package com.gitee.wsl.mathematics.vector.ext

import com.gitee.wsl.mathematics.vector.Vector
import com.gitee.wsl.mathematics.complex.quaternion.Quaternion
import com.gitee.wsl.mathematics.vector.vec2.Vector2
import com.gitee.wsl.mathematics.vector.vec3.Vector3
import com.gitee.wsl.mathematics.vector.vec4.Vector4

/*
operator fun<K: Vector2<T, *>> rem(other: K) = other.create(x % other.x, y % other.y)
operator fun<K: Vector3<T, *>> rem(other: K) = other.create(x % other.x, y % other.y, NaN)
operator fun<K: Vector4<T, *>> rem(other: K) = other.create(x % other.x, y % other.y, NaN, NaN)

operator fun<K: Vector2<T, *>> rem(other: K) =       create(x % other.x, y % other.y, NaN)
operator fun<K: Vector3<T, *>> rem(other: K) = other.create(x % other.x, y % other.y, z % other.z)
operator fun<K: Vector4<T, *>> rem(other: K) = other.create(x % other.x, y % other.y, z % other.z, NaN)

operator fun rem(other: Vector2<T, *>) = create(x % other.x, y % other.y, NaN, NaN)
operator fun rem(other: Vector3<T, *>) = create(x % other.x, y % other.y, z % other.z, NaN)
operator fun rem(other: Vector4<T, *>) = create(x % other.x, y % other.y, z % other.z, w % other.w)
*/

inline operator fun <T:Number, V: Vector<T, V>> Number.rem(vec: V):V = vec.remBy(this)

operator fun<T:Number,K: Vector2<T, K>> Vector2<T, *>.rem(other: K) = other.create(x % other.x, y % other.y)
operator fun<T:Number,K: Vector3<T, K>> Vector2<T, *>.rem(other: K) = other.create(x % other.x, y % other.y, NaN)
operator fun<T:Number,K: Vector4<T, K>> Vector2<T, *>.rem(other: K) = other.create(x % other.x, y % other.y, NaN, NaN)

operator fun<T:Number,V: Vector3<T, V>> Vector3<T, V>.rem(other: Vector2<T, *>) = create(x % other.x, y % other.y, NaN)
operator fun<T:Number,K: Vector3<T, K>> Vector3<T, K>.rem(other: Vector3<T, *>) = create(x % other.x, y % other.y, z % other.z)
operator fun<T:Number,K: Vector4<T, K>> Vector3<T, *>.rem(other: K)             = other.create(x % other.x, y % other.y, z % other.z, NaN)
operator fun<T:Number,K: Vector4<T, K>> Vector3<T, *>.rem(rotation: Quaternion<T, *>) = rotation % this

operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.rem(other: Vector2<T, *>) = create(x % other.x, y % other.y, NaN, NaN)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.rem(other: Vector3<T, *>) = create(x % other.x, y % other.y, z % other.z, NaN)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.rem(other: Vector4<T, *>) = create(x % other.x, y % other.y, z % other.z, w % other.w)


